﻿using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;

public class MetricManager {

    public Guid UserGuid { get; private set; }
    public Guid GameGuid { get; private set; }

    private Queue<Metric> metrics = new Queue<Metric>();



    private static MetricManager instance = null;

    public static MetricManager Instance
    {
        get
        {
            if (instance == null) instance = new MetricManager();
            return instance;
        }
    }

    private MetricManager()
    {
        GameGuid = Guid.Empty;

        UserGuid = new Guid(PlayerPrefs.GetString("userGuid", Guid.Empty.ToString()));
        if (UserGuid == Guid.Empty)
        {
            UserGuid = Guid.NewGuid();
            PlayerPrefs.SetString("userGuid", UserGuid.ToString());
            PlayerPrefs.Save();
        }
    }

    public void StartNewGame()
    {
        GameGuid = Guid.NewGuid();
        PlayerPrefs.SetString("gameGuid", GameGuid.ToString());
        PlayerPrefs.Save();
    }

    public void ClearMetricQueue()
    {
        metrics.Clear();
    }

}
